//将存在cookie中的字符串切成数组.
//console.log($.cookie("userName"));
//console.log($.cookie("passWord"));
var username = $.cookie("userName").split(",");
var mima = $.cookie("passWord").split(",");
//console.log(username);
//console.log(password.length);
//获取登录框的内容.


//点击事件.
$("#btn_index").bind("click",function(){
	var $name = $("#username").val();
	var $mima = $("#password").val();
//	console.log($mima == 5566997);
	var tmp = false;
	for(var i = 0; i<username.length; i++){
		if($name == username[i]){
			//alert("登录成功");
			for(var m = 0; m < mima.length; m++){
				if($mima == mima[m]){
					//alert("登录成功");
					//登录成功后设置一个cookie.让主页查看是否有就改变登录状态.
					$.cookie("sure",$name,{path:'/'});
					//如果成功改变开关.
					tmp = true;
					window.location.href = "index.html";
				}else{
					tmp = false;
				}
			}
			
		}
		
	}
	if(tmp == false){
		alert("密码错误");
	}
	//alert("账号或者密码错误");
})
